<?php

namespace app\controller;

use app\BaseController;
use app\common\lib\Snowflake;
use think\facade\Session;
use think\facade\Cache;

class Test extends BaseController{

    public function md5() {
        //halt(Session::get('test111'));
        halt(session(config('admin.session_admin')));
        echo md5('123456' . config("admin.passwd_salt"));
    }

    public function redis() {
        // 使用Redis缓存
        Cache::store('redis')->set('name','value',3600);
        $val = Cache::store('redis')->get('name');
        halt($val);
    }

    public function genOrderId() {
        $workId = rand(1, 1023);
        $orderId = Snowflake::getInstance()->setWorkId($workId)->id();
        p($orderId);
    }
}